--drop table if exists navinfo_stage_d002;

--创建外部表
create external table if not exists dongfeng.navinfo_stage_d002 (
        vehType                                           INT                 COMMENT '车型定义',
        tyreCount                                         INT                 COMMENT '轮胎个数',
        tireConditionItem                                 STRING              COMMENT '轮胎状态列表',
        alarmSign                                         INT                 COMMENT '报警标志',
        status                                            INT                 COMMENT '状态',
        latitude                                          INT                 COMMENT '纬度',
        longitude                                         INT                 COMMENT '经度',
        height                                            INT                 COMMENT '高程',
        direction                                         INT                 COMMENT '方向',
        gpsTime                                           BIGINT              COMMENT '时间',
        gpsSpeed                                          INT                 COMMENT 'GPS车速',
        terminalId                                        BIGINT              COMMENT '终端号',
        serialNumber                                      INT                 COMMENT '流水号',
        part_time                                         INT                 COMMENT '分区时间'
) row format delimited fields terminated by '\001' STORED AS TEXTFILE location '/user/data/dongfeng/stage_import_d002';

--drop table if exists navinfo_parquet_d002;

--创建目标表
create table if not exists dongfeng.navinfo_parquet_d002(
        vehType                                           INT                 COMMENT '车型定义',
        tyreCount                                         INT                 COMMENT '轮胎个数',
        tireConditionItem                                 STRING              COMMENT '轮胎状态列表',
        alarmSign                                         INT                 COMMENT '报警标志',
        status                                            INT                 COMMENT '状态',
        latitude                                          INT                 COMMENT '纬度',
        longitude                                         INT                 COMMENT '经度',
        height                                            INT                 COMMENT '高程',
        direction                                         INT                 COMMENT '方向',
        gpsTime                                           BIGINT              COMMENT '时间',
        gpsSpeed                                          INT                 COMMENT 'GPS车速',
        terminalId                                        BIGINT              COMMENT '终端号',
        serialNumber                                      INT                 COMMENT '流水号',
        create_time                                       STRING              COMMENT '数据创建时间'
) partitioned by (part_time int) stored as Parquet TBLPROPERTIES('parquet.compression'='SNAPPY');
